<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>苟有恒 何必三更起五更眠 最无益 莫过一日曝十日寒</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="苟有恒 何必三更起五更眠 最无益 莫过一日曝十日寒">
<meta property="og:url" content="http://dontworryneedmoney.gitee.io/guolianbo/page/5/index.html">
<meta property="og:site_name" content="苟有恒 何必三更起五更眠 最无益 莫过一日曝十日寒">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="worry dont">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/guolianbo/atom.xml" title="苟有恒 何必三更起五更眠 最无益 莫过一日曝十日寒" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  
<link rel="stylesheet" href="/guolianbo/css/style.css">

<meta name="generator" content="Hexo 4.2.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/guolianbo/" id="logo">苟有恒 何必三更起五更眠 最无益 莫过一日曝十日寒</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/guolianbo/">Home</a>
        
          <a class="main-nav-link" href="/guolianbo/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/guolianbo/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://dontworryneedmoney.gitee.io/guolianbo"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="ejs-dontworry/随笔/影响力读后感" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2020/02/20/dontworry/%E9%9A%8F%E7%AC%94/%E5%BD%B1%E5%93%8D%E5%8A%9B%E8%AF%BB%E5%90%8E%E6%84%9F/" class="article-date">
  <time datetime="2020-02-20T06:21:32.000Z" itemprop="datePublished">2020-02-20</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2020/02/20/dontworry/%E9%9A%8F%E7%AC%94/%E5%BD%B1%E5%93%8D%E5%8A%9B%E8%AF%BB%E5%90%8E%E6%84%9F/">影响力读后感</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="影响力读后感"><a href="#影响力读后感" class="headerlink" title="影响力读后感"></a>影响力读后感</h1><ul>
<li>我们在要别人帮忙的时候，要是能给一个理由，成功的概率会更大。</li>
<li>互惠原理所向披靡，先舍再得，拒绝-后撤手法</li>
<li>周围的人认为我们是什么样，对我们的自我认知起着十分重要的决定作用</li>
<li>一方面，是人们内心里有压力要把自我形象调整得与行为一致；另一方面，外部还存在一种更为鬼祟的压力，人们会按照他人对自己的感知来调整形象。</li>
<li>只有当我们认为外界不存在强大的压力时，我们才会为自己的行为发自内心地负起责任。</li>
<li>一般来说，由于人们的内心信仰系统需要保持一致，他们会宽慰自己：我选择的行为是正确的。</li>
<li>先给人一个甜头，诱使人作出有利的购买决定。而后，等决定作好了，交易却还没最终拍板，卖方巧妙地取消了最初的甜头。</li>
<li>抛低球，先用承诺一些甜头，让别人作出选择。然后在取消这些甜头，这样别人仍然会继续之前的选择不会变，这种操作太多了。比如，之前滴滴打车的补贴大战，外卖平台的补贴大战，都是这种抛低球的方法。</li>
<li>承诺一旦作出，就开始长出腿来支撑自己</li>
<li>社会认同原理发挥作用的一个重要条件：我们会根据他人的行为来判断自己怎么做才合适，尤其是在我们觉得这些人跟自己相似的时候。</li>
<li>镜子中看到的自己和别人眼中看到的自己左右脸是相反的。</li>
<li>顺从专业人士从来都在努力建立一种“我们和他们在为同一目标而奋斗”的氛围，这样我们必须为了共同的利益“团结一致”，他们其实是我们的“战友”。</li>
<li>第一，虽然接触带来的熟悉往往能导致更大的好感，可要是接触本身蕴含了让人反感的体验，就会起到适得其反的作用。</li>
<li>第二，有证据表明，以团队为导向的学习能缓解这种混乱状态。</li>
<li>根据关联原理，倘若我们能用一些哪怕是非常表面的方式（比如我们的居住地）让自己跟成功联系起来，我们的公共形象也会显得光辉起来。</li>
<li>在球迷评价比赛的时候，自己的主队赢了，就是“我们赢了”，输了就是“他们输了”，这个心理状态，太他妈的形象了。</li>
<li>很多情况下，只要有正统的权威说了话，其他本来应该考虑的事情就变得不相关了。</li>
<li>这个权威是真正的专家吗？</li>
<li>对失去某种东西的恐惧，似乎要比对获得同一物品的渴望，更能激发人们的行动力。</li>
<li>保住既得利益的愿望，是心理逆反理论的核心。</li>
<li>每当有东西获取起来比从前难，我们拥有它的自由受了限制，我们就越发地想要得到它。</li>
<li>想让信息变得更宝贵，不一定非要封杀它，只要把它弄成稀缺就行了。</li>
<li>自由这种东西，给一点又拿走，比完全不给更危险。</li>
<li>管教前后不一的父母，最容易教出反叛心强的孩子。</li>
<li>一旦在顺从环境下体验到高涨的情绪，我们就可以提醒自己：说不定有人在玩弄稀缺手法，必须谨慎行事。</li>
<li>倘若顺从业者公平公正地利用我们的捷径响应方式，我们就不应该把他们看成是敌人，事实上，他们是我们的盟友，有了他们，我们能更方便地开展高效率、高适应度的生意往来。只有那些通过弄虚作假、伪造或歪曲证据误导我们快捷响应的人才是正确的还击目标。</li>
<li></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2020/02/20/dontworry/%E9%9A%8F%E7%AC%94/%E5%BD%B1%E5%93%8D%E5%8A%9B%E8%AF%BB%E5%90%8E%E6%84%9F/" data-id="ckb6hw6sh003pjcn24us0bra0" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" rel="tag">随笔</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/随笔/不要在人多的时候批评别人" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2020/02/15/dontworry/%E9%9A%8F%E7%AC%94/%E4%B8%8D%E8%A6%81%E5%9C%A8%E4%BA%BA%E5%A4%9A%E7%9A%84%E6%97%B6%E5%80%99%E6%89%B9%E8%AF%84%E5%88%AB%E4%BA%BA/" class="article-date">
  <time datetime="2020-02-15T12:49:32.000Z" itemprop="datePublished">2020-02-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2020/02/15/dontworry/%E9%9A%8F%E7%AC%94/%E4%B8%8D%E8%A6%81%E5%9C%A8%E4%BA%BA%E5%A4%9A%E7%9A%84%E6%97%B6%E5%80%99%E6%89%B9%E8%AF%84%E5%88%AB%E4%BA%BA/">不要在人多的时候批评别人</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>人总是喜欢贬低他人来抬高自己，好像是一种原始的本能，喜欢站的比别人高，喜欢骑在他人头上，以此彰显自己的存在。<br>我认为这种特点，其实很无助于你达到你真正的目的。比如我和别人在讨论问题的时候，一定要做到对事不对人。不要用人称做主语。<br>比如，某某怎么如何，应该改为某某事如何。永远不要去负面的评价别人，哪怕内心中也不要去负面的评价别人。人没有对错，人做的事才<br>有对错之分。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2020/02/15/dontworry/%E9%9A%8F%E7%AC%94/%E4%B8%8D%E8%A6%81%E5%9C%A8%E4%BA%BA%E5%A4%9A%E7%9A%84%E6%97%B6%E5%80%99%E6%89%B9%E8%AF%84%E5%88%AB%E4%BA%BA/" data-id="ckb6hw6s5002jjcn23b7a8mkq" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" rel="tag">随笔</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/随笔/致富" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2020/02/14/dontworry/%E9%9A%8F%E7%AC%94/%E8%87%B4%E5%AF%8C/" class="article-date">
  <time datetime="2020-02-14T14:55:32.000Z" itemprop="datePublished">2020-02-14</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2020/02/14/dontworry/%E9%9A%8F%E7%AC%94/%E8%87%B4%E5%AF%8C/">致富</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="致富"><a href="#致富" class="headerlink" title="致富"></a><strong>致富</strong></h1><p>我是一个极度缺乏安全感的人，所有我需要钱，钱能带来安全感，特别是有了家庭后，我必须要更多的钱。我要付出什么才能得到钱呢？<br>我可以通过工作，获得工资。我可以提高技能，获得更高的工资。但是给别人打工又是风险特别大的得到金钱的方法。一本很出名的数《穷爸爸富爸爸》<br>的书讲的是怎么掌握金钱，提出很多概念，比如被动收入、人应该拥有自己的事业而不是工作、穷人为钱工作，富人让钱为自己赚钱。我也想通过什么样的方法实现财富自由，<br>可是没有门路，对于金钱也及其幼稚，很迷茫。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2020/02/14/dontworry/%E9%9A%8F%E7%AC%94/%E8%87%B4%E5%AF%8C/" data-id="ckb6hw6sk0042jcn2d6ksgkj1" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" rel="tag">随笔</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/随笔/己所不欲，勿施于人" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2020/01/11/dontworry/%E9%9A%8F%E7%AC%94/%E5%B7%B1%E6%89%80%E4%B8%8D%E6%AC%B2%EF%BC%8C%E5%8B%BF%E6%96%BD%E4%BA%8E%E4%BA%BA/" class="article-date">
  <time datetime="2020-01-10T17:15:32.000Z" itemprop="datePublished">2020-01-11</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/guolianbo/categories/%E9%9A%8F%E7%AC%94/">随笔</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2020/01/11/dontworry/%E9%9A%8F%E7%AC%94/%E5%B7%B1%E6%89%80%E4%B8%8D%E6%AC%B2%EF%BC%8C%E5%8B%BF%E6%96%BD%E4%BA%8E%E4%BA%BA/">己所不欲，勿施于人</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="己所不欲，勿施于人"><a href="#己所不欲，勿施于人" class="headerlink" title="己所不欲，勿施于人"></a>己所不欲，勿施于人</h1><p>“己所不欲，勿施于人”是一句很出名的古语，讲的就是自己不喜欢的东西，不要强加到别人身上。马上过完年就33岁了，以前觉得要让别人尊敬我，必须要能力超群。<br>可是现在到这个年纪，不能再蛮干了，想要在技术能力上成为真正的大牛，已经很难了。主要是天赋平平，机遇错过了，现在精力也不允许了。<br>人生的路还要继续走，还要继续进步，人生的路就是逆水行舟，不进则退。我应该要加强个人修养了，而且也是对这方面的事情有了一些领悟。<br>那些教养比较好的人，会让人如沐春风，大家都愿意和他们合作，他们的机会也会更多。那些教养差的人，会让人很不舒服，如果能不找他，就不<br>会去找他，这样的人路也会越走越窄。我自认为，我比普通人看问题都要透彻。可是教养真的挺差的，这个是我的短板，也是我一直到现在还一事无成的原因所在吧。<br>有两位关系还不错的老同事现在又到了这家公司共事，特别是其中一位朋友，特别喜欢做一些把自己的地位放在很低的位置的逗比行为。很多时候确实<br>会让整个气氛很欢乐。这也是我需要学习的地方，在不关紧要的事情上，把自己的地位放低一点，会更让人接受。我在实践中证明也确实如此，<br>这是一个宝贵的经验。<br>再说“己所不欲，勿施于人”这句古语，我觉得厉害就在于，他直接就告诉我们提高自己修养的实践方法了。当别人做了一件让你不喜欢的事情的时候，<br>以后自己就要注意了，不要这样对待别人。比如我觉得还可以的东西，如果别人直接就说这个是垃圾，我会觉得有点难受。所以在以后与人相处的过程中<br>对别人的观点，不要直接的否定，更加不要随意的嘲讽。这样不会让别人觉的你很厉害，只会觉得你很傲慢和无礼。比如我一个朋友喜欢看爱情公寓，我<br>觉得很一般，甚至就是个垃圾电视剧。我不能这么直接和他这个是垃圾电视剧，你怎么看这个。这是非常没有修养的行为，我应该说还不错，娱乐挺不<br>错的，也可以推荐一些更好看的电视剧给他。<br>在比如和人聊天或者沟通的时候多用正面的词汇，多用带情感的词汇。比如是的，好啊！等等。。。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2020/01/11/dontworry/%E9%9A%8F%E7%AC%94/%E5%B7%B1%E6%89%80%E4%B8%8D%E6%AC%B2%EF%BC%8C%E5%8B%BF%E6%96%BD%E4%BA%8E%E4%BA%BA/" data-id="ckb6hw6sj003wjcn2fyfve36q" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" rel="tag">随笔</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/随笔/游戏与程序" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2019/11/27/dontworry/%E9%9A%8F%E7%AC%94/%E6%B8%B8%E6%88%8F%E4%B8%8E%E7%A8%8B%E5%BA%8F/" class="article-date">
  <time datetime="2019-11-26T17:49:36.000Z" itemprop="datePublished">2019-11-27</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2019/11/27/dontworry/%E9%9A%8F%E7%AC%94/%E6%B8%B8%E6%88%8F%E4%B8%8E%E7%A8%8B%E5%BA%8F/">游戏与程序</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="游戏与程序"><a href="#游戏与程序" class="headerlink" title="游戏与程序"></a><strong>游戏与程序</strong></h1>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2019/11/27/dontworry/%E9%9A%8F%E7%AC%94/%E6%B8%B8%E6%88%8F%E4%B8%8E%E7%A8%8B%E5%BA%8F/" data-id="ckb6hw6sf003gjcn27av26vpv" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" rel="tag">随笔</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/杂项/CSharp的细节" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2019/09/12/dontworry/%E6%9D%82%E9%A1%B9/CSharp%E7%9A%84%E7%BB%86%E8%8A%82/" class="article-date">
  <time datetime="2019-09-12T14:11:35.000Z" itemprop="datePublished">2019-09-12</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2019/09/12/dontworry/%E6%9D%82%E9%A1%B9/CSharp%E7%9A%84%E7%BB%86%E8%8A%82/">CSharp的细节</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="CSharp的细节"><a href="#CSharp的细节" class="headerlink" title="CSharp的细节"></a>CSharp的细节</h1><h2 id="语言特性"><a href="#语言特性" class="headerlink" title="语言特性"></a>语言特性</h2><ul>
<li>基类转换成之子类用as,子类和子类之间的专线,应提供转换操作符,使用强制类型转换</li>
</ul>
<figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//  强制类型转换操作符</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">explicit</span> <span class="keyword">operator</span> <span class="title">SecondType</span>(<span class="params">FirstType firstType</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    SecondType st = <span class="keyword">new</span> SecondType();</span><br><span class="line">    <span class="keyword">return</span> st;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>as 操作符永远不会报异常,如果类型不匹配只会返回null</li>
<li>TryParse不会报异常,Parse会引发异常,异常会产生性能损耗</li>
<li>可空值类型int?</li>
<li>空接合操作符 ?? 只能作用于可空值类型</li>
<li>避免给枚举类型的元素提供显式的值, 因为编译器会逐个元素自动+1,稍不注意会出现重复值</li>
</ul>
<h2 id="深拷贝和浅拷贝"><a href="#深拷贝和浅拷贝" class="headerlink" title="深拷贝和浅拷贝"></a>深拷贝和浅拷贝</h2><ul>
<li>无论是深拷贝还是浅拷贝,微软都建议ICloneable接口</li>
<li>深拷贝最简单的方法是手动对字段进行赋值，这种方法容易出错，特别是类中还有其他需要深拷贝的引用变量。建议使用序列化的方法进行深拷贝</li>
</ul>
<figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line">[<span class="meta">Serializable</span>]</span><br><span class="line"><span class="keyword">class</span> <span class="title">Employee</span>: <span class="title">ICloneable</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Employee</span>(<span class="params"><span class="keyword">string</span> id, <span class="keyword">int</span> age, Department de</span>)</span></span><br><span class="line"><span class="function"></span>    &#123;</span><br><span class="line">        <span class="keyword">this</span>.IDCode = id;</span><br><span class="line">        <span class="keyword">this</span>.Age = age;</span><br><span class="line">        <span class="keyword">this</span>.Department = de;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> IDCode;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> Age;</span><br><span class="line">    <span class="keyword">public</span> Department Department;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">object</span> <span class="title">Clone</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>    &#123;</span><br><span class="line">        <span class="comment">// 浅拷贝方法</span></span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">this</span>.MemberwiseClone();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">// 深拷贝</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> Employee <span class="title">DeepClone</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>    &#123;</span><br><span class="line">        <span class="keyword">using</span> (Stream objectStream = <span class="keyword">new</span> MemoryStream())</span><br><span class="line">        &#123;</span><br><span class="line">            IFormatter formatter = <span class="keyword">new</span> BinaryFormatter();</span><br><span class="line">            formatter.Serialize(objectStream, <span class="keyword">this</span>);</span><br><span class="line">            objectStream.Seek(<span class="number">0</span>, SeekOrigin.Begin);</span><br><span class="line">            <span class="keyword">return</span> formatter.Deserialize(objectStream) <span class="keyword">as</span> Employee;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">// 浅拷贝</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> Employee <span class="title">ShallowClone</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>    &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">this</span>.Clone() <span class="keyword">as</span> Employee;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">[<span class="meta">Serializable</span>]</span><br><span class="line"><span class="keyword">class</span> <span class="title">Department</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Department</span>(<span class="params"><span class="keyword">string</span> name</span>)</span></span><br><span class="line"><span class="function"></span>    &#123;</span><br><span class="line">        <span class="keyword">this</span>.Name = name;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> Name;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<ul>
<li>使用dynamic实现反射(支持.NET4.0以上,unity使用的2.0,没啥卵用)</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2019/09/12/dontworry/%E6%9D%82%E9%A1%B9/CSharp%E7%9A%84%E7%BB%86%E8%8A%82/" data-id="ckb6hw6s2002bjcn2bciv3sq8" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E6%9D%82%E9%A1%B9/" rel="tag">杂项</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/杂项/CAD二次开发基础" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2019/09/04/dontworry/%E6%9D%82%E9%A1%B9/CAD%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91%E5%9F%BA%E7%A1%80/" class="article-date">
  <time datetime="2019-09-03T17:42:53.000Z" itemprop="datePublished">2019-09-04</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2019/09/04/dontworry/%E6%9D%82%E9%A1%B9/CAD%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91%E5%9F%BA%E7%A1%80/">CAD二次开发基础</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="CAD二次开发基础"><a href="#CAD二次开发基础" class="headerlink" title="CAD二次开发基础"></a>CAD二次开发基础</h1><!-- TOC -->

<ul>
<li><a href="#cad二次开发基础">CAD二次开发基础</a><ul>
<li><a href="#示例代码">示例代码</a></li>
</ul>
</li>
</ul>
<!-- /TOC -->
<h2 id="CAD开发中基本概念"><a href="#CAD开发中基本概念" class="headerlink" title="CAD开发中基本概念"></a>CAD开发中基本概念</h2><ul>
<li>每个CAD文件打开的文件在CAD中就是一个Document </li>
<li>Application.DocumentManager.MdiActiveDocument 表示当前激活的窗口</li>
<li>SendStringToExecute是一个异步方法,可以使用CommandEnded += MethodHandler,来进行回调</li>
</ul>
<h2 id="示例代码"><a href="#示例代码" class="headerlink" title="示例代码"></a>示例代码</h2><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">// 打开指定路径下的CAD文件</span></span><br><span class="line">[<span class="meta">CommandMethod(<span class="meta-string">"OpenDWGDXF"</span>, CommandFlags.Session)</span>]</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">OpenDWGDXF</span>(<span class="params"><span class="keyword">string</span> currentFile</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">try</span></span><br><span class="line">    &#123;</span><br><span class="line">        _currentFile = currentFile;</span><br><span class="line">        <span class="keyword">if</span> (<span class="keyword">string</span>.IsNullOrEmpty(_currentFile))</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="keyword">return</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">string</span> strFileName = _currentFile;</span><br><span class="line">        DocumentCollection acDocMgr = Application.DocumentManager;</span><br><span class="line">        Document doc = <span class="literal">null</span>;</span><br><span class="line">        <span class="keyword">if</span> (File.Exists(strFileName))</span><br><span class="line">        &#123;</span><br><span class="line">            doc = acDocMgr.Open(strFileName, <span class="literal">false</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">        &#123;</span><br><span class="line">            acDocMgr.MdiActiveDocument.Editor.WriteMessage(<span class="string">"File "</span> + strFileName + <span class="string">" does not exist."</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (doc == <span class="literal">null</span>)</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="keyword">return</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        acDocMgr.MdiActiveDocument = doc;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">catch</span> (Exception ex)</span><br><span class="line">    &#123;</span><br><span class="line">        ShowMsg(ex);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 删除指定类型的图元</span></span><br><span class="line">[<span class="meta">CommandMethod(<span class="meta-string">"DeleteTextDimension"</span>, CommandFlags.Modal)</span>]</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">DeleteTextDimension</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    Document doc = Application.DocumentManager.MdiActiveDocument;</span><br><span class="line">    <span class="keyword">if</span> (doc == <span class="literal">null</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">return</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    Editor ed = doc.Editor;</span><br><span class="line">    TypedValue[] tvs =</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">new</span> TypedValue((<span class="keyword">int</span>) DxfCode.Operator, <span class="string">"&lt;or"</span>),</span><br><span class="line">        <span class="keyword">new</span> TypedValue((<span class="keyword">int</span>) DxfCode.Start, <span class="string">"TEXT"</span>),</span><br><span class="line">        <span class="keyword">new</span> TypedValue((<span class="keyword">int</span>) DxfCode.Start, <span class="string">"DIMENSION"</span>),</span><br><span class="line">        <span class="keyword">new</span> TypedValue((<span class="keyword">int</span>) DxfCode.Operator, <span class="string">"or&gt;"</span>)</span><br><span class="line">    &#125;;</span><br><span class="line">    SelectionFilter sf = <span class="keyword">new</span> SelectionFilter(tvs);</span><br><span class="line">    PromptSelectionResult psr = ed.SelectAll(sf);</span><br><span class="line">    <span class="keyword">using</span> (Transaction trans = doc.TransactionManager.StartTransaction())</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">if</span> (psr.Status == PromptStatus.OK)</span><br><span class="line">        &#123;</span><br><span class="line">            SelectionSet SS = psr.Value;</span><br><span class="line">            ObjectId[] idArray = SS.GetObjectIds();</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; idArray.Length; i++)</span><br><span class="line">            &#123;</span><br><span class="line">                Entity ent = trans.GetObject(idArray[i], OpenMode.ForWrite) <span class="keyword">as</span> Entity;</span><br><span class="line">                ent.Erase(<span class="literal">true</span>);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        trans.Commit();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 导出DXF格式的文件</span></span><br><span class="line">[<span class="meta">CommandMethod(<span class="meta-string">"OutDxf"</span>, CommandFlags.Session)</span>]</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">OutDxf</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    Document doc = Application.DocumentManager.MdiActiveDocument;</span><br><span class="line">    <span class="keyword">if</span> (doc == <span class="literal">null</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">return</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">string</span> strDWGName = doc.Name;</span><br><span class="line">    <span class="keyword">object</span> obj = Application.GetSystemVariable(<span class="string">"DWGTITLED"</span>);</span><br><span class="line">    <span class="keyword">string</span> fileName = Path.GetFileNameWithoutExtension(strDWGName);</span><br><span class="line">    strDWGName = OutDirectory + fileName + <span class="string">".dxf"</span>;</span><br><span class="line">    <span class="keyword">this</span>._upLoadFilePath = strDWGName;</span><br><span class="line">    doc.Database.DxfOut(strDWGName, <span class="number">16</span>, DwgVersion.Current);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 关闭除当前窗口外的其他窗口</span></span><br><span class="line">[<span class="meta">CommandMethod(<span class="meta-string">"CloseDwgs"</span>)</span>]</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">CloseDwgs</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">var</span> dwg = Application.DocumentManager.MdiActiveDocument;</span><br><span class="line">    <span class="keyword">foreach</span> (Document d <span class="keyword">in</span> Application.DocumentManager)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">if</span> (!d.IsActive &amp;&amp; d.UnmanagedObject != dwg.UnmanagedObject)</span><br><span class="line">        &#123;</span><br><span class="line">            d.CloseAndDiscard();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    dwg.CommandEnded += StartUpLoadFile;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2019/09/04/dontworry/%E6%9D%82%E9%A1%B9/CAD%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91%E5%9F%BA%E7%A1%80/" data-id="ckb6hw6rt001hjcn28dnn3krm" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E6%9D%82%E9%A1%B9/" rel="tag">杂项</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/杂项/C#HTTP常用方法" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2019/09/04/dontworry/%E6%9D%82%E9%A1%B9/C#HTTP%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/" class="article-date">
  <time datetime="2019-09-03T17:42:53.000Z" itemprop="datePublished">2019-09-04</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2019/09/04/dontworry/%E6%9D%82%E9%A1%B9/C#HTTP%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/">C#HTTP常用方法</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="CSharp-HTTP常用方法"><a href="#CSharp-HTTP常用方法" class="headerlink" title="CSharp HTTP常用方法"></a>CSharp HTTP常用方法</h1><!-- TOC -->

<ul>
<li><a href="#csharp-http常用方法">CSharp HTTP常用方法</a><ul>
<li><a href="#get请求基本方法">get请求基本方法</a></li>
<li><a href="#post请求">Post请求</a></li>
<li><a href="#http下载文件">Http下载文件</a></li>
<li><a href="#post上传文件和键值对">post上传文件和键值对</a></li>
<li><a href="#http服务">Http服务</a></li>
</ul>
</li>
</ul>
<!-- /TOC -->


<h2 id="get请求基本方法"><a href="#get请求基本方法" class="headerlink" title="get请求基本方法"></a>get请求基本方法</h2><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> 发送Get请求</span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;/summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;param name="url"&gt;</span>地址<span class="doctag">&lt;/param&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;param name="dic"&gt;</span>请求参数定义<span class="doctag">&lt;/param&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;returns&gt;</span><span class="doctag">&lt;/returns&gt;</span></span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">string</span> <span class="title">Get</span>(<span class="params"><span class="keyword">string</span> url, Dictionary&lt;<span class="keyword">string</span>, <span class="keyword">string</span>&gt; dic</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">string</span> result = <span class="string">""</span>;</span><br><span class="line">    StringBuilder builder = <span class="keyword">new</span> StringBuilder();</span><br><span class="line">    builder.Append(url);</span><br><span class="line">    <span class="keyword">if</span> (dic.Count &gt; <span class="number">0</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        builder.Append(<span class="string">"?"</span>);</span><br><span class="line">        <span class="keyword">int</span> i = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">foreach</span> (<span class="keyword">var</span> item <span class="keyword">in</span> dic)</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="keyword">if</span> (i &gt; <span class="number">0</span>)</span><br><span class="line">            &#123; builder.Append(<span class="string">"&amp;"</span>); &#125;</span><br><span class="line">            builder.AppendFormat(<span class="string">"&#123;0&#125;=&#123;1&#125;"</span>, item.Key, item.Value);</span><br><span class="line">            i++;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());</span><br><span class="line">    <span class="comment">//添加参数</span></span><br><span class="line">    HttpWebResponse resp = (HttpWebResponse)req.GetResponse();</span><br><span class="line">    Stream stream = resp.GetResponseStream();</span><br><span class="line">    <span class="keyword">try</span></span><br><span class="line">    &#123;</span><br><span class="line">        <span class="comment">//获取内容</span></span><br><span class="line">        <span class="keyword">using</span> (StreamReader reader = <span class="keyword">new</span> StreamReader(stream))</span><br><span class="line">        &#123;</span><br><span class="line">            result = reader.ReadToEnd();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">finally</span></span><br><span class="line">    &#123;</span><br><span class="line">        stream.Close();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> result;</span><br><span class="line">&#125;</span><br><span class="line">```  </span><br><span class="line"></span><br><span class="line"><span class="meta">## Post请求</span></span><br><span class="line"></span><br><span class="line">```CSharp</span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> 创建POST方式的HTTP请求</span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;/summary&gt;</span></span></span><br><span class="line"><span class="function"><span class="keyword">public</span> HttpWebResponse <span class="title">CreatePostHttpResponse</span>(<span class="params"><span class="keyword">string</span> url, IDictionary&lt;<span class="keyword">string</span>, <span class="keyword">string</span>&gt; parameters,</span></span></span><br><span class="line"><span class="function"><span class="params">        <span class="keyword">int</span> timeout, <span class="keyword">string</span> userAgent, CookieCollection cookies</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    HttpWebRequest request = <span class="literal">null</span>;</span><br><span class="line">    <span class="comment">//如果是发送HTTPS请求</span></span><br><span class="line">    <span class="keyword">if</span> (url.StartsWith(<span class="string">"https"</span>, StringComparison.OrdinalIgnoreCase))</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="comment">//ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);</span></span><br><span class="line">        request = WebRequest.Create(url) <span class="keyword">as</span> HttpWebRequest;</span><br><span class="line">        <span class="comment">//request.ProtocolVersion = HttpVersion.Version10;</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">else</span></span><br><span class="line">    &#123;</span><br><span class="line">        request = WebRequest.Create(url) <span class="keyword">as</span> HttpWebRequest;</span><br><span class="line">    &#125;</span><br><span class="line">    request.Method = <span class="string">"POST"</span>;</span><br><span class="line">    request.ContentType = <span class="string">"application/x-www-form-urlencoded"</span>;</span><br><span class="line">    <span class="comment">//设置代理UserAgent和超时</span></span><br><span class="line">    <span class="comment">//request.UserAgent = userAgent;</span></span><br><span class="line">    <span class="comment">//request.Timeout = timeout;</span></span><br><span class="line">    <span class="keyword">if</span> (cookies != <span class="literal">null</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        request.CookieContainer = <span class="keyword">new</span> CookieContainer();</span><br><span class="line">        request.CookieContainer.Add(cookies);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">//发送POST数据</span></span><br><span class="line">    <span class="keyword">if</span> (!(parameters == <span class="literal">null</span> || parameters.Count == <span class="number">0</span>))</span><br><span class="line">    &#123;</span><br><span class="line">        StringBuilder buffer = <span class="keyword">new</span> StringBuilder();</span><br><span class="line">        <span class="keyword">int</span> i = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">foreach</span> (<span class="keyword">string</span> key <span class="keyword">in</span> parameters.Keys)</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="keyword">if</span> (i &gt; <span class="number">0</span>)</span><br><span class="line">            &#123;</span><br><span class="line">                buffer.AppendFormat(<span class="string">"&amp;&#123;0&#125;=&#123;1&#125;"</span>, key, parameters[key]);</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">else</span></span><br><span class="line">            &#123;</span><br><span class="line">                buffer.AppendFormat(<span class="string">"&#123;0&#125;=&#123;1&#125;"</span>, key, parameters[key]);</span><br><span class="line">                i++;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">byte</span>[] data = Encoding.ASCII.GetBytes(buffer.ToString());</span><br><span class="line">        <span class="keyword">using</span> (Stream stream = request.GetRequestStream())</span><br><span class="line">        &#123;</span><br><span class="line">            stream.Write(data, <span class="number">0</span>, data.Length);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">string</span>[] values = request.Headers.GetValues(<span class="string">"Content-Type"</span>);</span><br><span class="line">    <span class="keyword">return</span> request.GetResponse() <span class="keyword">as</span> HttpWebResponse;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> 获取请求的数据</span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;/summary&gt;</span></span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">string</span> <span class="title">GetResponseString</span>(<span class="params">HttpWebResponse webresponse</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">using</span> (Stream s = webresponse.GetResponseStream())</span><br><span class="line">    &#123;</span><br><span class="line">        StreamReader reader = <span class="keyword">new</span> StreamReader(s, Encoding.UTF8);</span><br><span class="line">        <span class="keyword">return</span> reader.ReadToEnd();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="Http下载文件"><a href="#Http下载文件" class="headerlink" title="Http下载文件"></a>Http下载文件</h2><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> http下载文件</span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;/summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;param name="url"&gt;</span>下载文件地址<span class="doctag">&lt;/param&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;param name="path"&gt;</span>文件存放地址，包含文件名<span class="doctag">&lt;/param&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;returns&gt;</span><span class="doctag">&lt;/returns&gt;</span></span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">bool</span> <span class="title">HttpDownload</span>(<span class="params"><span class="keyword">string</span> url, <span class="keyword">string</span> path</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">string</span> tempPath = System.IO.Path.GetDirectoryName(path) + <span class="string">@"\temp"</span>;</span><br><span class="line">    System.IO.Directory.CreateDirectory(tempPath);  <span class="comment">//创建临时文件目录</span></span><br><span class="line">    <span class="keyword">string</span> tempFile = tempPath + <span class="string">@"\"</span> + System.IO.Path.GetFileName(path) + <span class="string">".temp"</span>; <span class="comment">//临时文件</span></span><br><span class="line">    <span class="keyword">if</span> (System.IO.File.Exists(tempFile))</span><br><span class="line">    &#123;</span><br><span class="line">        System.IO.File.Delete(tempFile);    <span class="comment">//存在则删除</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">try</span></span><br><span class="line">    &#123;</span><br><span class="line">        FileStream fs = <span class="keyword">new</span> FileStream(tempFile, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);</span><br><span class="line">        <span class="comment">// 设置参数</span></span><br><span class="line">        HttpWebRequest request = WebRequest.Create(url) <span class="keyword">as</span> HttpWebRequest;</span><br><span class="line">        <span class="comment">//发送请求并获取相应回应数据</span></span><br><span class="line">        HttpWebResponse response = request.GetResponse() <span class="keyword">as</span> HttpWebResponse;</span><br><span class="line">        <span class="comment">//直到request.GetResponse()程序才开始向目标网页发送Post请求</span></span><br><span class="line">        Stream responseStream = response.GetResponseStream();</span><br><span class="line">        <span class="comment">//创建本地文件写入流</span></span><br><span class="line">        <span class="comment">//Stream stream = new FileStream(tempFile, FileMode.Create);</span></span><br><span class="line">        <span class="keyword">byte</span>[] bArr = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">1024</span>];</span><br><span class="line">        <span class="keyword">int</span> size = responseStream.Read(bArr, <span class="number">0</span>, (<span class="keyword">int</span>)bArr.Length);</span><br><span class="line">        <span class="keyword">while</span> (size &gt; <span class="number">0</span>)</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="comment">//stream.Write(bArr, 0, size);</span></span><br><span class="line">            fs.Write(bArr, <span class="number">0</span>, size);</span><br><span class="line">            size = responseStream.Read(bArr, <span class="number">0</span>, (<span class="keyword">int</span>)bArr.Length);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="comment">//stream.Close();</span></span><br><span class="line">        fs.Close();</span><br><span class="line">        responseStream.Close();</span><br><span class="line">        System.IO.File.Move(tempFile, path);</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">catch</span> (Exception ex)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="post上传文件和键值对"><a href="#post上传文件和键值对" class="headerlink" title="post上传文件和键值对"></a>post上传文件和键值对</h2><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">string</span> <span class="title">HttpPostData</span>(<span class="params"><span class="keyword">string</span> url, <span class="keyword">string</span> id, <span class="keyword">string</span> filePath</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">string</span> ip = GetLocalIp();</span><br><span class="line">    <span class="keyword">string</span> taskId = id;</span><br><span class="line">    <span class="keyword">string</span> fileName = filePath;</span><br><span class="line">    <span class="keyword">byte</span>[] fileContentByte = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">1024</span> * <span class="number">1024</span>]; <span class="comment">// 文件内容二进制</span></span><br><span class="line">    <span class="meta">#<span class="meta-keyword">region</span> 将文件转成二进制</span></span><br><span class="line">    FileStream fs = <span class="keyword">new</span> FileStream(filePath, FileMode.Open, FileAccess.Read);</span><br><span class="line">    fileContentByte = <span class="keyword">new</span> <span class="keyword">byte</span>[fs.Length]; <span class="comment">// 二进制文件</span></span><br><span class="line">    fs.Read(fileContentByte, <span class="number">0</span>, Convert.ToInt32(fs.Length));</span><br><span class="line">    fs.Close();</span><br><span class="line">    <span class="meta">#<span class="meta-keyword">endregion</span></span></span><br><span class="line">    <span class="meta">#<span class="meta-keyword">region</span> 定义请求体中的内容 并转成二进制</span></span><br><span class="line">    <span class="keyword">string</span> boundary = <span class="string">"---------------"</span> + DateTime.Now.Ticks.ToString(<span class="string">"x"</span>);</span><br><span class="line">    <span class="keyword">string</span> Enter = <span class="string">"\r\n"</span>;</span><br><span class="line">    <span class="keyword">string</span> localIp = <span class="string">"--"</span> + boundary + Enter</span><br><span class="line">                        + <span class="string">"Content-Disposition: form-data; name=\"ip\""</span> + Enter + Enter</span><br><span class="line">                        + ip + Enter;</span><br><span class="line">    <span class="keyword">string</span> fileContentStr = <span class="string">"--"</span> + boundary + Enter</span><br><span class="line">                            + <span class="string">"Content-Type:application/octet-stream"</span> + Enter</span><br><span class="line">                            + <span class="string">"Content-Disposition: form-data; name=\"file\"; filename=\""</span> + fileName + <span class="string">"\""</span> + Enter + Enter;</span><br><span class="line">    <span class="keyword">string</span> taskIdStr = Enter + <span class="string">"--"</span> + boundary + Enter</span><br><span class="line">                        + <span class="string">"Content-Disposition: form-data; name=\"id\""</span> + Enter + Enter</span><br><span class="line">                        + taskId;</span><br><span class="line">    <span class="keyword">var</span> localIpByte = Encoding.UTF8.GetBytes(localIp);<span class="comment">//ip所有字符串二进制</span></span><br><span class="line">    <span class="keyword">var</span> fileContentStrByte = Encoding.UTF8.GetBytes(fileContentStr);<span class="comment">//fileContent一些名称等信息的二进制（不包含文件本身）</span></span><br><span class="line">    <span class="keyword">var</span> taskIdByte = Encoding.UTF8.GetBytes(taskIdStr);<span class="comment">//id所有字符串二进制</span></span><br><span class="line">    <span class="meta">#<span class="meta-keyword">endregion</span></span></span><br><span class="line">    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);</span><br><span class="line">    request.Method = <span class="string">"POST"</span>;</span><br><span class="line">    request.ContentType = <span class="string">"multipart/form-data;boundary="</span> + boundary;</span><br><span class="line">    Stream myRequestStream = request.GetRequestStream();<span class="comment">//定义请求流</span></span><br><span class="line">    <span class="meta">#<span class="meta-keyword">region</span></span></span><br><span class="line">    myRequestStream.Write(localIpByte, <span class="number">0</span>, localIpByte.Length);</span><br><span class="line">    myRequestStream.Write(fileContentStrByte, <span class="number">0</span>, fileContentStrByte.Length);</span><br><span class="line">    myRequestStream.Write(fileContentByte, <span class="number">0</span>, fileContentByte.Length);</span><br><span class="line">    myRequestStream.Write(taskIdByte, <span class="number">0</span>, taskIdByte.Length);</span><br><span class="line">    <span class="meta">#<span class="meta-keyword">endregion</span></span></span><br><span class="line">    HttpWebResponse response = (HttpWebResponse)request.GetResponse();<span class="comment">//发送</span></span><br><span class="line">    Stream myResponseStream = response.GetResponseStream();<span class="comment">//获取返回值</span></span><br><span class="line">    StreamReader myStreamReader = <span class="keyword">new</span> StreamReader(myResponseStream, Encoding.GetEncoding(<span class="string">"utf-8"</span>));</span><br><span class="line">    <span class="keyword">string</span> retString = myStreamReader.ReadToEnd();</span><br><span class="line">    myStreamReader.Close();</span><br><span class="line">    myResponseStream.Close();</span><br><span class="line">    File.Delete(filePath);<span class="comment">// 上传后删除文件</span></span><br><span class="line">    <span class="keyword">return</span> retString;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="Http服务"><a href="#Http服务" class="headerlink" title="Http服务"></a>Http服务</h2><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">StartHttpServer</span>(<span class="params">Action&lt;<span class="keyword">string</span>&gt; showMsg</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    _httpPostRequest.Prefixes.Add(IMPORT_CAD_URL);</span><br><span class="line">    _httpPostRequest.Start();</span><br><span class="line">    Thread ThrednHttpPostRequest = <span class="keyword">new</span> Thread(<span class="keyword">new</span> ThreadStart(() =&gt; httpPostRequestHandle(showMsg)));</span><br><span class="line">    ThrednHttpPostRequest.Start();</span><br><span class="line">&#125;</span><br><span class="line">               </span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> 处理Post和get请求</span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;/summary&gt;</span></span></span><br><span class="line"><span class="comment"><span class="doctag">///</span> <span class="doctag">&lt;param name="showMsg"&gt;</span><span class="doctag">&lt;/param&gt;</span></span></span><br><span class="line"><span class="function"><span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">httpPostRequestHandle</span>(<span class="params">Action&lt;<span class="keyword">string</span>&gt; showMsg</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">while</span> (<span class="literal">true</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        HttpListenerContext requestContext = _httpPostRequest.GetContext();</span><br><span class="line">        Thread threadsub = <span class="keyword">new</span> Thread(<span class="keyword">new</span> ParameterizedThreadStart((requestcontext) =&gt;</span><br><span class="line">        &#123;</span><br><span class="line">            HttpListenerContext request = (HttpListenerContext) requestcontext;</span><br><span class="line">            <span class="keyword">string</span> userName = <span class="string">""</span>;</span><br><span class="line">            <span class="keyword">string</span> password = <span class="string">""</span>;</span><br><span class="line">            <span class="keyword">string</span> suffix = <span class="string">""</span>;</span><br><span class="line">            <span class="keyword">string</span> FileID = <span class="string">""</span>;</span><br><span class="line">            <span class="keyword">if</span> (</span><br><span class="line">                request.Request.HttpMethod == <span class="string">"POST"</span>)</span><br><span class="line">            &#123;</span><br><span class="line">                showMsg(<span class="string">"Post"</span>);</span><br><span class="line">                <span class="comment">//获取Post请求中的参数和值帮助类</span></span><br><span class="line">                HttpListenerPostParaHelper httppost = <span class="keyword">new</span> HttpListenerPostParaHelper(request);</span><br><span class="line">                <span class="comment">//获取Post过来的参数和数据</span></span><br><span class="line">                List&lt;HttpListenerPostValue&gt; lst = httppost.GetHttpListenerPostValue();</span><br><span class="line">                <span class="comment">//使用方法</span></span><br><span class="line">                <span class="keyword">foreach</span> (<span class="keyword">var</span> key <span class="keyword">in</span> lst)</span><br><span class="line">                &#123;</span><br><span class="line">                    <span class="keyword">if</span> (key.type == <span class="number">0</span>)</span><br><span class="line">                    &#123;</span><br><span class="line">                        <span class="keyword">string</span> <span class="keyword">value</span> = Encoding.UTF8.GetString(key.datas).Replace(<span class="string">"\r\n"</span>, <span class="string">""</span>);</span><br><span class="line">                        <span class="keyword">if</span> (key.name == <span class="string">"username"</span>)</span><br><span class="line">                        &#123;</span><br><span class="line">                            userName = <span class="keyword">value</span>;</span><br><span class="line">                            showMsg(key.name + <span class="string">": "</span> + <span class="keyword">value</span>);</span><br><span class="line">                        &#125;</span><br><span class="line">                        <span class="keyword">if</span> (key.name == <span class="string">"password"</span>)</span><br><span class="line">                        &#123;</span><br><span class="line">                            password = <span class="keyword">value</span>;</span><br><span class="line">                            showMsg(key.name + <span class="string">": "</span> + <span class="keyword">value</span>);</span><br><span class="line">                        &#125;</span><br><span class="line">                        <span class="keyword">if</span> (key.name == <span class="string">"suffix"</span>)</span><br><span class="line">                        &#123;</span><br><span class="line">                            suffix = <span class="keyword">value</span>;</span><br><span class="line">                            showMsg(key.name + <span class="string">": "</span> + <span class="keyword">value</span>);</span><br><span class="line">                        &#125;</span><br><span class="line">                        <span class="keyword">if</span> (key.name == <span class="string">"file"</span>)</span><br><span class="line">                        &#123;</span><br><span class="line">                            <span class="comment">//                                    FileID = value;</span></span><br><span class="line">                            <span class="comment">//                                    showMsg(key.name + ": " + value);</span></span><br><span class="line">                            WriteByteToFile(key.datas, <span class="string">@"D:\inCADFile\test.dwg"</span>);</span><br><span class="line">                            showMsg(<span class="string">"Done!"</span>);</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;</span><br><span class="line">                    <span class="keyword">if</span> (key.type == <span class="number">1</span>)</span><br><span class="line">                    &#123;</span><br><span class="line">                        <span class="keyword">string</span> fileName = <span class="string">"test.dwg"</span>;</span><br><span class="line">                        <span class="keyword">string</span> directory = <span class="string">@"D:\inCADFile\"</span>;<span class="comment">//AppDomain.CurrentDomain.BaseDirectory</span></span><br><span class="line">                        <span class="comment">//                                string fileName = request.Request.QueryString["FileName"];</span></span><br><span class="line">                        <span class="keyword">if</span> (!<span class="keyword">string</span>.IsNullOrEmpty(fileName))</span><br><span class="line">                        &#123;</span><br><span class="line">                            <span class="keyword">string</span> filePath = directory +</span><br><span class="line">                                                DateTime.Now.ToString(<span class="string">"yyMMdd_HHmmss_ffff"</span>) +</span><br><span class="line">                                                Path.GetExtension(fileName).ToLower();</span><br><span class="line">                            <span class="keyword">if</span> (key.name == <span class="string">"file"</span>)</span><br><span class="line">                            &#123;</span><br><span class="line">                                FileStream fs = <span class="keyword">new</span> FileStream(filePath, FileMode.Create);</span><br><span class="line">                                fs.Write(key.datas, <span class="number">0</span>, key.datas.Length);</span><br><span class="line">                                fs.Close();</span><br><span class="line">                                fs.Dispose();</span><br><span class="line">                            &#125;</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span> (</span><br><span class="line">                request.Request.HttpMethod == <span class="string">"GET"</span>)</span><br><span class="line">            &#123;</span><br><span class="line">                showMsg(<span class="string">"GET"</span>);</span><br><span class="line">                FileID = request.Request.QueryString[<span class="string">"FileID"</span>];</span><br><span class="line">                suffix = request.Request.QueryString[<span class="string">"suffix"</span>];</span><br><span class="line">                password = request.Request.QueryString[<span class="string">"password"</span>];</span><br><span class="line">                userName = request.Request.QueryString[<span class="string">"username"</span>];</span><br><span class="line">                showMsg(userName);</span><br><span class="line">                showMsg(password);</span><br><span class="line">                showMsg(suffix);</span><br><span class="line">                showMsg(FileID);</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="comment">//Response</span></span><br><span class="line">            request.Response.StatusCode = <span class="number">200</span>;</span><br><span class="line">            request.Response.Headers.Add(<span class="string">"Access-Control-Allow-Origin"</span>, <span class="string">"*"</span>);</span><br><span class="line">            request.Response.ContentType = <span class="string">"application/json"</span>;</span><br><span class="line">            requestContext.Response.ContentEncoding = Encoding.UTF8;</span><br><span class="line">            <span class="keyword">byte</span>[] buffer =</span><br><span class="line">                System.Text.Encoding.UTF8.GetBytes(</span><br><span class="line">                    Newtonsoft.Json.JsonConvert.SerializeObject(<span class="keyword">new</span> &#123;success = <span class="string">"true"</span>, msg = <span class="string">"提交成功"</span>&#125;));</span><br><span class="line">            request.Response.ContentLength64 = buffer.Length;</span><br><span class="line">            <span class="keyword">var</span> output = request.Response.OutputStream;</span><br><span class="line">            output.Write(buffer, <span class="number">0</span>, buffer.Length);</span><br><span class="line">            output.Close();</span><br><span class="line">        &#125;));</span><br><span class="line">        threadsub.Start(requestContext);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2019/09/04/dontworry/%E6%9D%82%E9%A1%B9/C#HTTP%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/" data-id="ckb6hw6sn004bjcn20v76b578" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E6%9D%82%E9%A1%B9/" rel="tag">杂项</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/Unity3d/带颜色的调试log" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2019/09/04/dontworry/Unity3d/%E5%B8%A6%E9%A2%9C%E8%89%B2%E7%9A%84%E8%B0%83%E8%AF%95log/" class="article-date">
  <time datetime="2019-09-03T17:41:47.000Z" itemprop="datePublished">2019-09-04</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2019/09/04/dontworry/Unity3d/%E5%B8%A6%E9%A2%9C%E8%89%B2%E7%9A%84%E8%B0%83%E8%AF%95log/">带颜色的调试log</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="带颜色的调试log"><a href="#带颜色的调试log" class="headerlink" title="带颜色的调试log"></a>带颜色的调试log</h1><ul>
<li><p>增加一个扩展方法,使输出的log带颜色,特别是和别人一起开发的时候能很好的区分自己和别人的log</p>
<figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[<span class="meta">Conditional (<span class="meta-string">"DEBUG"</span>)</span>]</span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> <span class="title">DebugLogExtension</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">LbLogger</span>(<span class="params"><span class="keyword">this</span> <span class="keyword">object</span> obj, <span class="keyword">string</span> message</span>)</span></span><br><span class="line"><span class="function"></span>    &#123;</span><br><span class="line">        <span class="keyword">var</span> sb = <span class="keyword">new</span> StringBuilder(<span class="string">"&lt;color=#00EEEE&gt;"</span>);</span><br><span class="line">        sb.Append(message);</span><br><span class="line">        sb.Append(<span class="string">"&lt;/color&gt;"</span>);</span><br><span class="line">        Debug.Log(sb);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>在本地写入日志<br>// TODO</p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2019/09/04/dontworry/Unity3d/%E5%B8%A6%E9%A2%9C%E8%89%B2%E7%9A%84%E8%B0%83%E8%AF%95log/" data-id="ckb6hw6r80010jcn26n8fb5gr" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/Unity3d/" rel="tag">Unity3d</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="ejs-dontworry/杂项/开发方法论1.0" class="article article-type-ejs" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/guolianbo/2019/09/01/dontworry/%E6%9D%82%E9%A1%B9/%E5%BC%80%E5%8F%91%E6%96%B9%E6%B3%95%E8%AE%BA1.0/" class="article-date">
  <time datetime="2019-09-01T15:08:23.000Z" itemprop="datePublished">2019-09-01</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/guolianbo/2019/09/01/dontworry/%E6%9D%82%E9%A1%B9/%E5%BC%80%E5%8F%91%E6%96%B9%E6%B3%95%E8%AE%BA1.0/">开发方法论1.0</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="开发方法论1-0"><a href="#开发方法论1-0" class="headerlink" title="开发方法论1.0"></a>开发方法论1.0</h1><!-- TOC -->

<ul>
<li><a href="#开发方法论10">开发方法论1.0</a><ul>
<li><a href="#项目背景介绍">项目背景介绍</a></li>
<li><a href="#完全未知的项目如何收集资料">完全未知的项目如何收集资料</a><ul>
<li><a href="#rule">Rule</a></li>
</ul>
</li>
<li><a href="#开发中技术细节">开发中技术细节</a><ul>
<li><a href="#经验">经验</a></li>
</ul>
</li>
<li><a href="#经验-1">经验</a></li>
</ul>
</li>
</ul>
<!-- /TOC -->
<h2 id="项目背景介绍"><a href="#项目背景介绍" class="headerlink" title="项目背景介绍"></a>项目背景介绍</h2><ul>
<li>利用AutoCAD软件(Windows平台下)的二次开发功能,对户型CAD图做许多处理.然后输出DXF图,其中需要通过Http服务来进行获取图和输出图.</li>
<li>在此之前,完全没有用过CAD软件</li>
</ul>
<h2 id="完全未知的项目如何收集资料"><a href="#完全未知的项目如何收集资料" class="headerlink" title="完全未知的项目如何收集资料"></a>完全未知的项目如何收集资料</h2><p>在此次项目中,我走了很多弯路,特别是对资料文档的获取.大多数人收集资料的的第一选择肯定是百度,这样没有问题,可是软件行业,几乎所有的基础和知识都是来源于英语世界.所以使用百度,搜索的东西大部分是中文国内的技术博客如CSDN,博客园等,以别人分享的博客为主.这类知识对于肤浅的认识是很快捷的,其实就是二手知识.二手知识的危害就不细说了.百度搜索到的内容,其实只能让你对要做的事情有一个基本概念, 比如CAD二次开发中使用的脚本语言就有4种,lisp,vb,C# ,C++.我当时几乎花了一天的时间去研究lisp怎么写.后来发现这方面的资料实在是太少了,非常不利于以后的开发.后来经过调研,决定使用C#,正好通过看视频,也发现了一些CAD二次开发的书籍(比较老了),确实给了我很大的帮助.这里要重点说一下<strong>视频</strong>, 视频可以算是新媒体.特别是技术上的东西,不需要讲理论,就是要最实际的东西,所以一部好的入门视频,会帮助开发者节省很多时间.等入门后,再去研究那些高深的理论,才是正常人类学习的正常流程.很多人学习成绩差,或者觉得书本上的知识都无用,可以说也是这种以书籍为核心学习方法的本身反人类导致的.</p>
<p>CAD的版本介绍<img src="../assets/CADVersion.png" alt=""></p>
<h3 id="Rule"><a href="#Rule" class="headerlink" title="Rule"></a>Rule</h3><ul>
<li>根据开发资料文档,确定技术选择,比如C#的资料明显多于lisp</li>
<li>第一次见面,尽量使用视频媒体,多看相关视频,不用细看,只要知道一些基本概念,有一个第一印象很重要</li>
<li>视频资料肯定会大大少于文档的资料,所以按照视频去开发是非常不现实的</li>
<li>尽量使用国外的搜索引擎进行搜索(会发现很多问题直接指向的是<font color=red>官方论坛和官方文档</font>)</li>
<li>官方的文档才是一手知识的,其他所有的都是二手知识</li>
<li>英语很重要,多学英语</li>
</ul>
<h2 id="开发中技术细节"><a href="#开发中技术细节" class="headerlink" title="开发中技术细节"></a>开发中技术细节</h2><p>在具体开发中,主要分为两块  </p>
<ol>
<li>与后台对接的网络服务(收发),这一块没什么底,特别网络服务又要涉及到多线程,更加不熟悉</li>
<li>CAD脚本开发</li>
</ol>
<p>在使用线程过程中,因为要通过网络来调用CAD的命令,会出现一个” 调用线程无法访问此对象,因为另一个线程拥有该对象” ,当我碰到这个报错的,第一反应是搜索,在试了很多方法后,都不能解决,其实在搜索过程,出现频率最高的一个方法是</p>
<figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">this</span>.Dispatcher.Invoke(() =&gt;</span><br><span class="line">&#123;</span><br><span class="line">    ...<span class="comment">// your code here.</span></span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<p>可是我一直在纠结这个this.Dispatcher是怎么来的,所以停滞不前,试了很多其他的方法,都不行.在这件事情上,凭感觉发现这种方法出现频率最高之后,应该差不多要确定就是这种方法才能解决问题了.<br>在很多时候,当大量的搜索资料后,其实方法已经很明显了.当然这种事情需要的时间可能是一个星期或者超过一个星期.<br>最后的最后,我是通过github搜索代码,发现一个this.Dispatcher的声明抄过来的,当时也只是试试,没想到成功了.</p>
<p>在整个解决问题的过程中,浪费了非常多的时间,这就开发效率低下的表现,如果高效率的解决问题是非常重要的.</p>
<h3 id="经验"><a href="#经验" class="headerlink" title="经验"></a>经验</h3><ul>
<li>快速的试错,从频率最高的方法开始测试</li>
<li>在解决问题时,要快速的弄清楚原理,如果原理很陌生和复杂,就直接抄写.</li>
<li>快速的集中精力的阅读,很重要,如果只是随便看看,有时候反而会更慢的解决问题</li>
</ul>
<h2 id="经验-1"><a href="#经验-1" class="headerlink" title="经验"></a>经验</h2><ul>
<li>保持高效的工作状态,越拖延效率越低</li>
<li>宁可重头来过,也不要踌躇不前</li>
<li>很多人喜欢强调先想清楚了,在行动,这种思维方式在竞争中是没有优势可言的,正确的做法是先做了,再想,宁可犯错,多重复几次,也不要踌躇不前.不要害怕犯错,犯错是最宝贵的财富.</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://dontworryneedmoney.gitee.io/guolianbo/2019/09/01/dontworry/%E6%9D%82%E9%A1%B9/%E5%BC%80%E5%8F%91%E6%96%B9%E6%B3%95%E8%AE%BA1.0/" data-id="ckb6hw6s3002djcn2eo3vdqp5" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/guolianbo/tags/%E6%9D%82%E9%A1%B9/" rel="tag">杂项</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    
    <a class="extend prev" rel="prev" href="/guolianbo/page/4/">&amp;laquo; Prev</a><a class="page-number" href="/guolianbo/">1</a><span class="space">&hellip;</span><a class="page-number" href="/guolianbo/page/3/">3</a><a class="page-number" href="/guolianbo/page/4/">4</a><span class="page-number current">5</span><a class="page-number" href="/guolianbo/page/6/">6</a><a class="page-number" href="/guolianbo/page/7/">7</a><span class="space">&hellip;</span><a class="page-number" href="/guolianbo/page/9/">9</a><a class="extend next" rel="next" href="/guolianbo/page/6/">Next &amp;raquo;</a>
  </nav>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/guolianbo/categories/%E9%9A%8F%E7%AC%94/">随笔</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/guolianbo/tags/Algorithm/" rel="tag">Algorithm</a></li><li class="tag-list-item"><a class="tag-list-link" href="/guolianbo/tags/Unity3d/" rel="tag">Unity3d</a></li><li class="tag-list-item"><a class="tag-list-link" href="/guolianbo/tags/%E6%9D%82%E9%A1%B9/" rel="tag">杂项</a></li><li class="tag-list-item"><a class="tag-list-link" href="/guolianbo/tags/%E6%B6%88%E9%98%B2/" rel="tag">消防</a></li><li class="tag-list-item"><a class="tag-list-link" href="/guolianbo/tags/%E7%94%B3%E8%AE%BA/" rel="tag">申论</a></li><li class="tag-list-item"><a class="tag-list-link" href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" rel="tag">随笔</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/guolianbo/tags/Algorithm/" style="font-size: 14px;">Algorithm</a> <a href="/guolianbo/tags/Unity3d/" style="font-size: 12px;">Unity3d</a> <a href="/guolianbo/tags/%E6%9D%82%E9%A1%B9/" style="font-size: 18px;">杂项</a> <a href="/guolianbo/tags/%E6%B6%88%E9%98%B2/" style="font-size: 16px;">消防</a> <a href="/guolianbo/tags/%E7%94%B3%E8%AE%BA/" style="font-size: 10px;">申论</a> <a href="/guolianbo/tags/%E9%9A%8F%E7%AC%94/" style="font-size: 20px;">随笔</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2020/06/">June 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2020/05/">May 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2020/04/">April 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2020/03/">March 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2020/02/">February 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2020/01/">January 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2019/11/">November 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2019/09/">September 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2019/08/">August 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2019/07/">July 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/guolianbo/archives/2019/06/">June 2019</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/guolianbo/2020/06/08/dontworry/Unity3d/IObserver%E5%92%8CIObservable%E5%92%8CIDisposable/">IObserver和IObservable和IDisposable</a>
          </li>
        
          <li>
            <a href="/guolianbo/2020/05/28/dontworry/%E6%9D%82%E9%A1%B9/javascript%E7%9A%84%E6%9C%AC%E8%B4%A8/">javascript的本质</a>
          </li>
        
          <li>
            <a href="/guolianbo/2020/05/27/dontworry/%E6%9D%82%E9%A1%B9/%E5%8D%8F%E7%A8%8B%E7%9A%84%E5%8E%9F%E7%90%86/">协程的原理</a>
          </li>
        
          <li>
            <a href="/guolianbo/2020/05/20/dontworry/%E6%9D%82%E9%A1%B9/linux%E4%B8%8B%E7%9A%84nginx%E7%9A%84%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C/">linux下的nginx的基本操作</a>
          </li>
        
          <li>
            <a href="/guolianbo/2020/05/15/dontworry/%E6%9D%82%E9%A1%B9/%E5%B8%B8%E7%94%A8%E5%87%BD%E6%95%B0%E5%8A%A8%E8%AF%8D/">常用函数动词</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2020 worry dont<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/guolianbo/" class="mobile-nav-link">Home</a>
  
    <a href="/guolianbo/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  
<link rel="stylesheet" href="/guolianbo/fancybox/jquery.fancybox.css">

  
<script src="/guolianbo/fancybox/jquery.fancybox.pack.js"></script>




<script src="/guolianbo/js/script.js"></script>




  </div>
</body>
</html>